#! /usr/bin/env python
# encoding=utf-8

from xml.dom.ext.reader import Sax2
from xml import xpath
import sys

doc = Sax2.FromXmlFile('micasa.xml').documentElement
for nodo in xpath.Evaluate('//habitacion[puerta[@a="' + sys.argv[1] + '"]]', doc):
	print nodo.getAttribute('id')